package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.pojo.OrderSetting;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface OrderSettingMapper extends BaseMapper<OrderSetting> {
    @Select("SELECT count(1) from order_setting_t  " +
            "where number > reservations  and order_date =#{orderDate}")
    int isOrderOkByOrderDate(@Param("orderDate") String orderDate);

    @Update("update order_setting_t set  reservations = reservations+1  where order_date = #{orderDate} ")
    void updateReservationsByOrderDate(@Param("orderDate") String orderDate);

}
